package org.jeecg.modules.business.enums;

import org.jeecg.common.system.vo.DictModel;

import java.util.ArrayList;
import java.util.List;

public enum CustomerTypeEnum {

//    All(null,"所有"),
    NORMAL(1,"散客"),
    VIP(2,"会员"),
    PROTOCOL(3,"协议单位"),
    PROXY(4,"中介");

    Integer key;

    String title;

    CustomerTypeEnum(Integer key, String title){
        this.key = key;
        this.title = title;
    }
    public Integer getKey() {
        return key;
    }

    public String getTitle() {
        return title;
    }

    /**
     * 获取字典数据
     * @return
     */
    public static List<DictModel> getDictList(){
        List<DictModel> list = new ArrayList<>();
        DictModel dictModel = null;
        for(CouponsEventEnum e: CouponsEventEnum.values()){
            dictModel = new DictModel();
            dictModel.setValue(e.key.toString());
            dictModel.setText(e.title);
            list.add(dictModel);
        }
        return list;
    }

    public static CustomerTypeEnum val(Integer key){
        for(CustomerTypeEnum bld: values()){
            if(bld.key .equals(key)){
                return bld;
            }
        }
        return null;
    }
}
